package com.xyy.saas.payment.enums;

import java.util.Arrays;
import java.util.Map;
import java.util.function.UnaryOperator;
import java.util.stream.Collectors;

public enum OpenAccountStatusEnum {
    // 0. 未提交资料
    // 1. 已提交资料
    // 2. 开富民基本户成功
    // 3. 已向富民提交了进件资料
    // 4. 富民进件中待审核
    // 5. 富民进件中待用户签署协议
    // 6. 富民进件成功
    // 7. 支付功能开通情况()
    // 8. 已提交微信开户意愿申请
    // 9. 待法人扫码确认联系人信息
    // 10. 微信开户意愿申请 审核通过
    // 11. 待法人扫码授权
    // 12. 开户成功
    // 102. 开富民基本户失败
    // 104. 富民进件失败
    // 108. 微信开户意愿申请失败

    UN_COMMIT(0,"UN_COMMIT", "未提交资料"),
    COMMIT_DATA_2_FM(1,"COMMIT_DATA_2_FM", "已向富民提交开户资料"),
    OPEN_BASE_ACCOUNT_SUCCESS(2,"OPEN_BASE_ACCOUNT_SUCCESS", "开富民基本户成功"),
    OPEN_BASE_ACCOUNT_FAIL(102,"OPEN_BASE_ACCOUNT_FAIL", "开富民基本户失败"),
    COMMIT_CREATE_PAY_2_FM(3,"COMMIT_CREATE_PAY_2_FM", "已向富民提交了进件资料"),
    CREATE_PAY_WAIT_AUDIT(4,"CREATE_PAY_WAIT_AUDIT", "富民进件-审核中"),
    CREATE_PAY_FAIL(104,"CREATE_PAY_FAIL", "富民进件失败"),
    WAIT_SIGN(5,"WAIT_SIGN", "富民进件中-待用户签署协议"),
    CREATE_PAY_PASS(6,"CREATE_PAY_PASS", "富民进件成功-审核通过"),
    OPEN_PAY_STATUS(7,"OPEN_PAY_STATUS", "开通支付功能情况"),
    COMMIT_DATA_2_WX(8,"COMMIT_DATA_2_WX", "已提交微信开户意愿申请"),
    APPLYMENT_FAIL(108,"APPLYMENT_FAIL", "微信开户意愿申请失败"),
    WAIT_CONFIRM(9,"WAIT_CONFIRM", "待法人扫码确认联系人信息"),
    APPLYMENT_PASS(10,"APPLYMENT_PASS", "审核通过"),
    WAIT_AUTH(11,"WAIT_AUTH", "待法人扫码授权"),
    OPEN_ACCOUNT_SUCCESS(12,"OPEN_ACCOUNT_SUCCESS", "开户成功");

    private Integer step;
    private String code;
    private String desc;

    private static Map<String, OpenAccountStatusEnum> code2Enum;

    static {
        code2Enum = Arrays.asList(values()).stream().collect(Collectors.toMap(OpenAccountStatusEnum::getCode, UnaryOperator.identity()));
    }

    public static OpenAccountStatusEnum getEnum(String code){
        return code2Enum.get(code);
    }

    OpenAccountStatusEnum(Integer step, String code, String desc){
        this.step = step;
        this.code = code;
        this.desc = desc;
    }

    public String getCode() {
        return code;
    }

    public String getDesc() {
        return desc;
    }

    public Integer getStep() {
        return step;
    }

    public void setStep(Integer step) {
        this.step = step;
    }
}
